body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f5f5f5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
  text-align: center;
  color: #333;
}

.controls {
  margin: 20px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

select {
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

button {
  padding: 8px 16px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

button:hover {
  background-color: #45a049;
}

#remove-selected {
  background-color: #f44336;
}

#remove-selected:hover {
  background-color: #d32f2f;
}

#save-btn {
  background-color: #2196F3;
}

#save-btn:hover {
  background-color: #0b7dda;
}

/* 修改网格背景和尺寸 */
.grid-stack {
  background-image: 
    linear-gradient(#e0e0e0 1px, transparent 1px),
    linear-gradient(90deg, #e0e0e0 1px, transparent 1px);
  background-size: 10px 10px;
  background-color: #f9f9f9;
  min-height: 400px;
  margin: 0;
  padding: 0;
}

.grid-stack-item {
  margin: 0 !important;
  box-sizing: border-box;
  position: absolute;
}

.grid-stack-item-content {
  background-color: white;
  border: 1px solid #ddd;
  padding: 0;
  box-shadow: none;
  position: relative;
  height: calc(100% - 2px);
  width: calc(100% - 2px);
  overflow: hidden;
  box-sizing: border-box;
}

/* 确保所有部件内容严格适应网格 */
[class$="-widget"] {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 调整具体部件样式 */
.text-widget {
  padding: 2px;
  font-size: 8px;
}

.button-widget .widget-btn {
  padding: 2px;
  font-size: 8px;
}

.switch {
  transform: scale(0.5);
  transform-origin: top left;
}

.image-widget img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 图表部件样式 - 固定高度 */
.chart-widget {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  box-sizing: border-box;
}

.chart-placeholder {
  width: 100%;
  height: 100%;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

.remove-widget {
  position: absolute;
  top: 5px;
  right: 5px;
  cursor: pointer;
  font-size: 20px;
  color: #f44336;
  display: none;
  z-index: 10;
  background: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  text-align: center;
  line-height: 24px;
}

.grid-stack-item:hover .remove-widget {
  display: block;
}

/* 确保网格项内容不会超出 */
.grid-stack-item-content > * {
  max-width: 100%;
  max-height: 100%;
}